#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define TOTAL_LEN 27

typedef struct _node {
    char c;
    int w;
    struct _node *lchild;
    struct _node *rchild;
    struct _node *next;
    struct _node *prev;
} NODE, *NODEPTR;

NODEPTR create_node(char c, int w)
{
    NODEPTR ptr = (NODEPTR)malloc(sizeof(NODE));

    ptr->c = c;
    ptr->w = w;
    ptr->lchild = NULL;
    ptr->rchild = NULL;
    ptr->next = NULL;
    ptr->prev = NULL;

    return ptr;
}

int free_node(NODE *ptr)
{
    free(ptr);

    return 0;
}

NODEPTR ht_init()
{
    NODEPTR head = create_node('*', 99999999);
    head->prev = head;
    head->next = head;
    return head;
}

int ht_free(NODEPTR root)
{
    if (root != NULL) {
        ht_free(root->lchild);
        ht_free(root->rchild);

        free_node(root);
    }

    return 0;
}

NODEPTR ht_min(NODEPTR head)
{
    NODEPTR min = head->next;
    NODEPTR cur_ptr = min;
    while (cur_ptr != head) {
        if (cur_ptr->w < min->w) {
            min = cur_ptr;
        }
        cur_ptr = cur_ptr->next;
    }

    return min;
}

NODEPTR ht_insert(NODEPTR head, NODEPTR ptr)
{
    ptr->next = head->next;
    head->next->prev = ptr;
    head->next = ptr;
    ptr->prev = head;

    return head;
}

NODEPTR ht_delete(NODEPTR head, NODEPTR ptr)
{
    ptr->prev->next = ptr->next;
    ptr->next->prev = ptr->prev;
    ptr->prev = NULL;
    ptr->next = NULL;

    return head;
}

NODEPTR ht_merge(NODEPTR lchild, NODEPTR rchild)
{
    NODEPTR root = create_node('*', lchild->w + rchild->w);
    root->lchild = lchild;
    root->rchild = rchild;

    return root;
}

int ht_sum(NODEPTR root, int level)
{
    if (root->lchild == NULL && root->rchild == NULL) {
        return root->w * level;
    } else {
        return ht_sum(root->lchild, level+1) + ht_sum(root->rchild, level+1);
    }
}

void print_node(NODEPTR node, int level)
{
    if (node != NULL) {
        while (level--) {
            printf("--");
        }
        printf("[%p] %c %d [t:%p %p] [l:%p %p]\n", 
                node,
                node->c,
                node->w,
                node->lchild,
                node->rchild,
                node->prev,
                node->next);
    }

    return;
}

void ht_print(NODEPTR root, int level) 
{
    if (root != NULL) {
        print_node(root, level);
        ht_print(root->lchild, level+1);
        ht_print(root->rchild, level+1);
    }

    return;
}

void print_forest(NODEPTR head)
{
    if (head->next == head) {
        return;
    }

    NODEPTR cur_ptr = head->next;
    while (cur_ptr->next == head) {
        ht_print(cur_ptr, 0);
        cur_ptr = cur_ptr->next;
    }

    return;
}

int main (int argc, char const* argv[])
{
    char buf[256];
    int i, len, rec[TOTAL_LEN], orig_len, comp_len;

    while (scanf("%s", buf) != EOF) {
        if (strcmp(buf, "END") == 0) {
            break;
        }

        for (i = 0; i < TOTAL_LEN; i++) {
            rec[i] = 0;
        }

        len = strlen(buf);
        orig_len = len * 8;

        /* count character */
        for (i = 0; i < len; i++) {
            if (buf[i] == '_') {
                rec[0]++;
            } else {
                rec[buf[i] - 'A' + 1]++;
            }
        }

        /* copy */
        NODEPTR root = ht_init();
        NODEPTR node;

        int node_n = 0;
        if (rec[0] != 0) {
            node = create_node('_', rec[0]);
            ht_insert(root, node);
            node_n++;
        }

        for (i = 1; i < TOTAL_LEN; i++) {
            if (rec[i] > 0) {
                node = create_node(i - 1 + 'A', rec[i]);
                ht_insert(root, node);
                node_n++;
            }
        }

        /* build */
        for (i = 0; i < node_n-1; i++) {
            NODEPTR lchild = ht_min(root);
            ht_delete(root, lchild);
            NODEPTR rchild = ht_min(root);
            ht_delete(root, rchild);

            node = ht_merge(lchild, rchild);

            ht_insert(root, node);
        }

        /* print_forest(root); */
        comp_len = ht_sum(root->next, 0);

        if (root->next->lchild == NULL && root->next->rchild == NULL) {
            comp_len = 1 * root->next->w;
        }

        ht_free(root);

        printf("%d %d %.1f\n", orig_len, comp_len, orig_len/(double)comp_len);
    }

    return 0;
}
